<template>
  <div class="hotspot-analysis">
    <div class="section-header">
      <h3>热点分析</h3>
    </div>
    
    <div class="hotspot-list">
      <div 
        v-for="(hotspot, index) in hotspots" 
        :key="index"
        class="hotspot-item"
      >
        <div class="hotspot-info">
          <div class="hotspot-position">
            {{ hotspot.position }}
          </div>
          <div class="hotspot-details">
            <span class="pressure-value">{{ hotspot.pressure }} kPa</span>
            <span class="duration">{{ hotspot.duration }}</span>
          </div>
        </div>
        <div class="hotspot-action">
          <button class="view-btn" @click="viewHotspot(hotspot)">
            查看
          </button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HotspotAnalysis',
  props: {
    hotspots: {
      type: Array,
      required: true
    }
  },
  methods: {
    viewHotspot(hotspot) {
      this.$emit('view-hotspot', hotspot)
    }
  }
}
</script>

<style scoped>
.hotspot-analysis {
  background: #FFFFFF;
  box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #000000;
  margin: 0;
  line-height: 24px;
}

.hotspot-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hotspot-item {
  background: #F9FAFB;
  border-radius: 6px;
  padding: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.hotspot-item:hover {
  background: #F3F4F6;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hotspot-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hotspot-position {
  font-size: 14px;
  font-weight: 500;
  color: #000000;
  line-height: 20px;
}

.hotspot-details {
  display: flex;
  gap: 12px;
  align-items: center;
}

.pressure-value {
  color: #6B7280;
  font-size: 12px;
  line-height: 16px;
}

.duration {
  color: #6B7280;
  font-size: 12px;
  line-height: 16px;
}

.hotspot-action {
  display: flex;
  align-items: center;
}

.view-btn {
  background: none;
  border: none;
  color: #1677FF;
  font-size: 12px;
  line-height: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.view-btn:hover {
  background: #E6F4FF;
  color: #0958d9;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .hotspot-analysis {
    padding: 16px;
  }
  
  .hotspot-item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .hotspot-action {
    justify-content: center;
  }
}
</style>
